import Vue from 'vue'
import App from './App.vue'

Vue.config.productionTip = false

// 引入 vue-router 
import VueRouter from 'vue-router'

// Vue 安装插件
Vue.use(VueRouter)

// 引入 组件
import Index from './views/Index.vue'
import Class from './views/Class.vue'
import Order from './views/Order.vue'
import My from './views/My.vue'

// 创建路由规则数组
let routes = [
  {
    path: '/',
    redirect: '/index'
  },
  {
    path: '/index',
    component: Index
  },
  {
    path: '/class',
    component: Class
  },
  {
    path: '/order',
    component: Order
  },
  {
    path: '/my',
    component: My
  },
]

// 根据规则创建路由对象
let router = new VueRouter({
  routes,
  mode: 'history'
})

// 将路由对象挂载到 new Vue 的配置对象中
new Vue({
  render: h => h(App),
  router
}).$mount('#app')
